package com.mrdeer.iot.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.MongoId;

import java.io.Serializable;
import java.util.concurrent.TimeUnit;

/**
 * @Author: xie jianchu
 */
@Data
@Document
@Accessors(chain = true)
@ApiModel(value = "设备实体")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DeviceEntity implements Serializable {

    private static final long serialVersionUID = 1617325055802475442L;

    @MongoId
    private ObjectId id;

    @ApiModelProperty(value = "设备名称")
    private String name;

    @ApiModelProperty(value = "硬件MAC码")
    private String mac;

    @ApiModelProperty(value = "address")
    private String address;

    @ApiModelProperty(value = "店铺ID")
    private String shopId;

    private String userId;

    private String command;

    @ApiModelProperty(value = "设备类型")
    private String type;

    private String otaVersion;

    @ApiModelProperty(value = "描述")
    private String description;

    @ApiModelProperty(value = "删除标志 默认为0")
    private Integer delFlag = 0;

    @Transient
    private int timeOut = 15;

    @Transient
    private TimeUnit timeUnit = TimeUnit.MINUTES;

    private Long originTime;

    private Long confirmTime;

    private Integer status;

    public DeviceEntity() {
    }

    public DeviceEntity(String name, String mac, String address, String shopId, String userId, String command, String type, String otaVersion, String description, Integer delFlag, Integer status) {
        this.name = name;
        this.mac = mac;
        this.address = address;
        this.shopId = shopId;
        this.userId = userId;
        this.command = command;
        this.type = type;
        this.otaVersion = otaVersion;
        this.description = description;
        this.delFlag = delFlag;
        this.status = status;
    }
}
